﻿using System;
using System.Windows;
using Flux.Editor.Extensions;

namespace Flux.Editor.Dialogs
{
	public partial class NewProjectDialog
	{
		public string ProjectName { get; set; }
		public int TileWidth { get; set; }
		public int TileHeight { get; set; }


		public NewProjectDialog()
		{
			InitializeComponent();
		}

		private void BtnOk_OnClick(object sender, RoutedEventArgs e)
		{
			if (string.IsNullOrEmpty(txtProjectName.Text))
			{
				MessageBox.Show("Project needs a name");
				return;
			}

			if (!txtTileWidth.Text.IsNumeric())
			{
				MessageBox.Show("Tile Width needs to be numeric");
				return;
			}

			if (!txtTileHeight.Text.IsNumeric())
			{
				MessageBox.Show("Tile Height needs to be numeric");
				return;
			}

			ProjectName = txtProjectName.Text;
			TileWidth = Convert.ToInt32(txtTileWidth.Text);
			TileHeight = Convert.ToInt32(txtTileHeight.Text);

			DialogResult = true;
		}

		private void BtnCancel_OnClick(object sender, RoutedEventArgs e)
		{
			DialogResult = false;
		}
	}
}
